String Class Reference
[Abstract Data Types]

String. More...

#include <fstring.h>

Inheritance diagram for String:
Inheritance graph
[legend]

Public Types

enum  CharGroup { kSpace, kNotAlphaNum, kNotAlpha }

Public Member Functions

 String ()
 String (const char8 *str, int32 n=-1, bool isTerminated=true)
 assign n characters of str (-1: all)
 String (const char16 *str, int32 n=-1, bool isTerminated=true)
 assign n characters of str (-1: all)
 String (const String &str, int32 n=-1)
 assign n characters of str (-1: all)
 String (const ConstString &str, int32 n=-1)
 assign n characters of str (-1: all)
 String (const FVariant &var)
 assign from FVariant
 ~String ()
void updateLength ()
 Call this when the string is truncated outside (not recommended though).
virtual const char8 * text8 () const
virtual const char16 * text16 () const
virtual char8 getChar8 (uint32 index) const
virtual char16 getChar16 (uint32 index) const
bool setChar8 (uint32 index, char8 c)
bool setChar16 (uint32 index, char16 c)
bool setChar (uint32 index, char8 c)
bool setChar (uint32 index, char16 c)
Stringoperator= (const char8 *str)
 Assign from a string of type char8.
Stringoperator= (const char16 *str)
Stringoperator= (const ConstString &str)
Stringoperator= (const String &str)
Stringoperator= (char8 c)
Stringoperator= (char16 c)
Stringassign (const ConstString &str, int32 n=-1)
 Assign n characters of str (-1: all).
Stringassign (const char8 *str, int32 n=-1, bool isTerminated=true)
 Assign n characters of str (-1: all).
Stringassign (const char16 *str, int32 n=-1, bool isTerminated=true)
 Assign n characters of str (-1: all).
Stringassign (char8 c, int32 n=1)
Stringassign (char16 c, int32 n=1)
Stringappend (const ConstString &str, int32 n=-1)
 Append n characters of str to this (n=-1: all).
Stringappend (const char8 *str, int32 n=-1)
 Append n characters of str to this (n=-1: all).
Stringappend (const char16 *str, int32 n=-1)
 Append n characters of str to this (n=-1: all).
Stringappend (const char8 c, int32 n=1)
 Append char c n times.
Stringappend (const char16 c, int32 n=1)
 Append char c n times.
StringinsertAt (uint32 idx, const ConstString &str, int32 n=-1)
 Insert n characters of str at position idx (n=-1: all).
StringinsertAt (uint32 idx, const char8 *str, int32 n=-1)
 Insert n characters of str at position idx (n=-1: all).
StringinsertAt (uint32 idx, const char16 *str, int32 n=-1)
 Insert n characters of str at position idx (n=-1: all).
StringinsertAt (uint32 idx, char8 c)
StringinsertAt (uint32 idx, char16 c)
Stringoperator+= (const String &str)
Stringoperator+= (const ConstString &str)
Stringoperator+= (const char8 *str)
Stringoperator+= (const char16 *str)
Stringoperator+= (const char8 c)
Stringoperator+= (const char16 c)
Stringreplace (uint32 idx, int32 n1, const ConstString &str, int32 n2=-1)
 Replace n1 characters of this (starting at idx) with n2 characters of str (n1,n2=-1: until end).
Stringreplace (uint32 idx, int32 n1, const char8 *str, int32 n2=-1)
 Replace n1 characters of this (starting at idx) with n2 characters of str (n1,n2=-1: until end).
Stringreplace (uint32 idx, int32 n1, const char16 *str, int32 n2=-1)
 Replace n1 characters of this (starting at idx) with n2 characters of str (n1,n2=-1: until end).
int32 replace (const char8 *toReplace, const char8 *toReplaceWith, bool all=false)
 Replace find string with replace string - returns number of replacements.
int32 replace (const char16 *toReplace, const char16 *toReplaceWith, bool all=false)
 Replace find string with replace string - returns number of replacements.
bool replaceChars8 (const char8 *toReplace, char8 toReplaceBy)
 Returns true when any replacement was done.
bool replaceChars16 (const char16 *toReplace, char16 toReplaceBy)
bool replaceChars8 (char8 toReplace, char8 toReplaceBy)
bool replaceChars16 (char16 toReplace, char16 toReplaceBy)
bool replaceChars (char8 toReplace, char8 toReplaceBy)
bool replaceChars (char16 toReplace, char16 toReplaceBy)
bool replaceChars (const char8 *toReplace, char8 toReplaceBy)
bool replaceChars (const char16 *toReplace, char16 toReplaceBy)
Stringremove (uint32 index=0, int32 n=-1)
 Remove n characters from string starting at index (n=-1: until end).
bool trim (CharGroup mode=kSpace)
 Trim lead/trail.
void removeChars (CharGroup mode=kSpace)
 Removes all of group.
bool removeChars8 (const char8 *which)
 Remove all occurrences of each char in 'which'.
bool removeChars16 (const char16 *which)
 Remove all occurrences of each char in 'which'.
bool removeChars8 (const char8 which)
bool removeChars16 (const char16 which)
bool removeChars (const char8 *which)
bool removeChars (const char16 *which)
bool removeChars (const char8 which)
bool removeChars (const char16 which)
bool removeSubString (const ConstString &subString, bool allOccurences=true)
Stringprintf (const char8 *format,...)
 Print formatted data into string.
Stringprintf (const char16 *format,...)
 Print formatted data into string.
Stringvprintf (const char8 *format, va_list args)
Stringvprintf (const char16 *format, va_list args)
StringprintInt64 (int64 value)
StringprintFloat (double value)
bool incrementTrailingNumber (uint32 width=2, char separator=STR(' '), uint32 minNumber=1, bool applyOnlyFormat=false)
 Increment the trailing number if present else start with minNumber, width specifies the string width format (width 2 for number 3 is 03), applyOnlyFormat set to true will only format the string to the given width without incrementing the founded trailing number.
bool fromVariant (const FVariant &var)
 Assigns string from FVariant.
void toVariant (FVariant &var) const
bool fromAttributes (IAttributes *a, IAttrID attrID)
 Assigns string from FAttributes.
bool toAttributes (IAttributes *a, IAttrID attrID)
void swapContent (String &s)
 Swaps ownership of the strings pointed to.
void take (String &str)
 Take ownership of the string of 'str'.
void take (void *buffer, bool wide)
 Take ownership of buffer.
void * pass ()
void passToVariant (FVariant &var)
 Pass ownership of buffer to Variant - sets Variant ownership.
void toLower (uint32 index)
 Lower case the character.
void toLower ()
 Lower case the string.
void toUpper (uint32 index)
 Upper case the character.
void toUpper ()
 Upper case the string.
unsigned char * toPascalString (unsigned char *buf)
 Pascal string conversion.
const StringfromPascalString (const unsigned char *buf)
 Pascal string conversion.
bool toWideString (uint32 sourceCodePage=kCP_Default)
 Converts to wide string according to sourceCodePage.
bool toMultiByte (uint32 destCodePage=kCP_Default)
void fromUTF8 (const char8 *utf8String)
 Assigns from UTF8 string.
bool normalize (UnicodeNormalization=kUnicodeNormC)
 On PC only kUnicodeNormC is working.

Protected Member Functions

bool resize (uint32 newSize, bool wide, bool fill=false)

Detailed Description

String.

Extends class ConstString by operations which allow modifications.

See also:
ConstString

Member Enumeration Documentation

enum CharGroup
Enumerator:
kSpace 
kNotAlphaNum 
kNotAlpha 

Constructor & Destructor Documentation

String (  ) 
String ( const char8 *  str,
int32  n = -1,
bool  isTerminated = true 
)

assign n characters of str (-1: all)

String ( const char16 *  str,
int32  n = -1,
bool  isTerminated = true 
)

assign n characters of str (-1: all)

String ( const String str,
int32  n = -1 
)

assign n characters of str (-1: all)

String ( const ConstString str,
int32  n = -1 
)

assign n characters of str (-1: all)

String ( const FVariant &  var  ) 

assign from FVariant

~String (  ) 

Member Function Documentation

void updateLength (  ) 

Call this when the string is truncated outside (not recommended though).

const char8 * text8 (  )  const [inline, virtual]

Reimplemented from ConstString.

const char16 * text16 (  )  const [inline, virtual]

Reimplemented from ConstString.

char8 getChar8 ( uint32  index  )  const [inline, virtual]

Reimplemented from ConstString.

char16 getChar16 ( uint32  index  )  const [inline, virtual]

Reimplemented from ConstString.

bool setChar8 ( uint32  index,
char8  c 
)
bool setChar16 ( uint32  index,
char16  c 
)
bool setChar ( uint32  index,
char8  c 
) [inline]
bool setChar ( uint32  index,
char16  c 
) [inline]
String& operator= ( const char8 *  str  )  [inline]

Assign from a string of type char8.

String& operator= ( const char16 *  str  )  [inline]
String& operator= ( const ConstString str  )  [inline]
String& operator= ( const String str  )  [inline]
String& operator= ( char8  c  )  [inline]
String& operator= ( char16  c  )  [inline]
String & assign ( const ConstString str,
int32  n = -1 
)

Assign n characters of str (-1: all).

String & assign ( const char8 *  str,
int32  n = -1,
bool  isTerminated = true 
)

Assign n characters of str (-1: all).

String & assign ( const char16 *  str,
int32  n = -1,
bool  isTerminated = true 
)

Assign n characters of str (-1: all).

String & assign ( char8  c,
int32  n = 1 
)
String & assign ( char16  c,
int32  n = 1 
)
String & append ( const ConstString str,
int32  n = -1 
)

Append n characters of str to this (n=-1: all).

String & append ( const char8 *  str,
int32  n = -1 
)

Append n characters of str to this (n=-1: all).

String & append ( const char16 *  str,
int32  n = -1 
)

Append n characters of str to this (n=-1: all).

String & append ( const char8  c,
int32  n = 1 
)

Append char c n times.

String & append ( const char16  c,
int32  n = 1 
)

Append char c n times.

String & insertAt ( uint32  idx,
const ConstString str,
int32  n = -1 
)

Insert n characters of str at position idx (n=-1: all).

String & insertAt ( uint32  idx,
const char8 *  str,
int32  n = -1 
)

Insert n characters of str at position idx (n=-1: all).

String & insertAt ( uint32  idx,
const char16 *  str,
int32  n = -1 
)

Insert n characters of str at position idx (n=-1: all).

String& insertAt ( uint32  idx,
char8  c 
) [inline]
String& insertAt ( uint32  idx,
char16  c 
) [inline]
String& operator+= ( const String str  )  [inline]
String& operator+= ( const ConstString str  )  [inline]
String& operator+= ( const char8 *  str  )  [inline]
String& operator+= ( const char16 *  str  )  [inline]
String& operator+= ( const char8  c  )  [inline]
String& operator+= ( const char16  c  )  [inline]
String & replace ( uint32  idx,
int32  n1,
const ConstString str,
int32  n2 = -1 
)

Replace n1 characters of this (starting at idx) with n2 characters of str (n1,n2=-1: until end).

String & replace ( uint32  idx,
int32  n1,
const char8 *  str,
int32  n2 = -1 
)

Replace n1 characters of this (starting at idx) with n2 characters of str (n1,n2=-1: until end).

String & replace ( uint32  idx,
int32  n1,
const char16 *  str,
int32  n2 = -1 
)

Replace n1 characters of this (starting at idx) with n2 characters of str (n1,n2=-1: until end).

int32 replace ( const char8 *  toReplace,
const char8 *  toReplaceWith,
bool  all = false 
)

Replace find string with replace string - returns number of replacements.

int32 replace ( const char16 *  toReplace,
const char16 *  toReplaceWith,
bool  all = false 
)

Replace find string with replace string - returns number of replacements.

bool replaceChars8 ( const char8 *  toReplace,
char8  toReplaceBy 
)

Returns true when any replacement was done.

bool replaceChars16 ( const char16 *  toReplace,
char16  toReplaceBy 
)
bool replaceChars8 ( char8  toReplace,
char8  toReplaceBy 
) [inline]
bool replaceChars16 ( char16  toReplace,
char16  toReplaceBy 
) [inline]
bool replaceChars ( char8  toReplace,
char8  toReplaceBy 
) [inline]
bool replaceChars ( char16  toReplace,
char16  toReplaceBy 
) [inline]
bool replaceChars ( const char8 *  toReplace,
char8  toReplaceBy 
) [inline]
bool replaceChars ( const char16 *  toReplace,
char16  toReplaceBy 
) [inline]
String & remove ( uint32  index = 0,
int32  n = -1 
)

Remove n characters from string starting at index (n=-1: until end).

bool trim ( String::CharGroup  group = kSpace  ) 

Trim lead/trail.

void removeChars ( CharGroup  mode = kSpace  ) 

Removes all of group.

bool removeChars8 ( const char8 *  which  ) 

Remove all occurrences of each char in 'which'.

bool removeChars16 ( const char16 *  which  ) 

Remove all occurrences of each char in 'which'.

bool removeChars8 ( const char8  which  )  [inline]
bool removeChars16 ( const char16  which  )  [inline]
bool removeChars ( const char8 *  which  )  [inline]
bool removeChars ( const char16 *  which  )  [inline]
bool removeChars ( const char8  which  )  [inline]
bool removeChars ( const char16  which  )  [inline]
bool removeSubString ( const ConstString subString,
bool  allOccurences = true 
)
String & printf ( const char8 *  format,
  ... 
)

Print formatted data into string.

String & printf ( const char16 *  format,
  ... 
)

Print formatted data into string.

String & vprintf ( const char8 *  format,
va_list  args 
)
String & vprintf ( const char16 *  format,
va_list  args 
)
String & printInt64 ( int64  value  ) 
String & printFloat ( double  value  ) 
bool incrementTrailingNumber ( uint32  width = 2,
char  separator = STR (' '),
uint32  minNumber = 1,
bool  applyOnlyFormat = false 
)

Increment the trailing number if present else start with minNumber, width specifies the string width format (width 2 for number 3 is 03), applyOnlyFormat set to true will only format the string to the given width without incrementing the founded trailing number.

bool fromVariant ( const FVariant &  var  ) 

Assigns string from FVariant.

void toVariant ( FVariant &  var  )  const

Reimplemented from ConstString.

bool fromAttributes ( IAttributes *  a,
IAttrID  attrID 
)

Assigns string from FAttributes.

bool toAttributes ( IAttributes *  a,
IAttrID  attrID 
)
void swapContent ( String s  ) 

Swaps ownership of the strings pointed to.

void take ( String str  ) 

Take ownership of the string of 'str'.

void take ( void *  buffer,
bool  wide 
)

Take ownership of buffer.

Reimplemented in StringObject.

void * pass (  ) 
void passToVariant ( FVariant &  var  ) 

Pass ownership of buffer to Variant - sets Variant ownership.

void toLower ( uint32  index  ) 

Lower case the character.

void toLower (  ) 

Lower case the string.

void toUpper ( uint32  index  ) 

Upper case the character.

void toUpper (  ) 

Upper case the string.

unsigned char * toPascalString ( unsigned char *  buf  ) 

Pascal string conversion.

const String & fromPascalString ( const unsigned char *  buf  ) 

Pascal string conversion.

bool toWideString ( uint32  sourceCodePage = kCP_Default  ) 

Converts to wide string according to sourceCodePage.

bool toMultiByte ( uint32  destCodePage = kCP_Default  ) 
void fromUTF8 ( const char8 *  utf8String  ) 

Assigns from UTF8 string.

bool normalize ( UnicodeNormalization  n = kUnicodeNormC  ) 

On PC only kUnicodeNormC is working.

bool resize ( uint32  newSize,
bool  wide,
bool  fill = false 
) [protected]
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.